/**
 * Created by hxs 
 */

function get_cw_echarts(rtn) {
    var arr_num = new Array;//
    var arr_dat = new Array;
    var arr_num_fa = new Array;//

    for (var i = 0; i <= rtn.ze_c_je.length - 1; i++) {
        //console.log(rtn.jdqs[i].numa);
        arr_num.push(rtn.ze_c_je[i].suM2);
        arr_dat.push(rtn.ze_c_je[i].dat);
    }

    for (var i = 0; i <= rtn.ze_c_je.length - 1; i++) {
        //console.log(rtn.jdqs[i].numa);
        arr_num_fa.push(rtn.ze_c_je[i].suM1);
        //arr_dat.push(rtn.jdqs[i].dat);
    }

    var myChart = echarts.init(document.getElementById('container_huan'));
    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            x: 46,
            y: 30,
            x2: 32,
            y2: 40,
            borderWidth: 0
        },
        legend: {
            data: ['整车存量资金（万）', ''],
            textStyle: {
                color: "#e9ebee"

            }
        },
        xAxis: [
            {
                type: 'category',
                data: arr_dat,
                splitLine: {
                    show: false 
                },
                axisLabel: {
                    interval: 0,
                    show: true,
                    textStyle: {
                        color: '#a4a7ab',
                        align: 'center'
                    }
                }
            }
        ],
        yAxis: [
            {
                type: 'value',
                splitLine: {
                    show: false
                },
                axisLabel: {
                    show: true,
                    textStyle: {
                        color: '#a4a7ab'
                    }
                }
            }
        ],
        series: [
            {
                name: '销售接单',
                type: 'bar',
                data: arr_num,
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            position: 'top',
                            formatter: "{c}",
                        }
                    },
                }
            },
            /*{
                name: '销售发车',
                type: 'bar',
                data: arr_num_fa,
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            position: 'top',
                            formatter: "{c}",
                        }
                    },
                }
            },*/
        ]
    };

    myChart.setOption(option);
};


function get_bie_echarts(rtn) {

    var arr_num = new Array;//
    var arr_models = new Array;//['套餐A', '套餐B', '套餐C', '套餐D', '套餐E']
   

    for (var i = 0; i <= rtn.k_type_bl.length - 1; i++) {
        //console.log(rtn.jdqs[i].numa);
        let t = {
            value: rtn.k_type_bl[i].co,
            name: rtn.k_type_bl[i].models
        }
        arr_num.push(t);
        arr_models.push(rtn.k_type_bl[i].models);
    }
    var myChart = echarts.init(document.getElementById('container16'));
    option = {
       /* legend: {
            orient: 'vertical',
            x: 'left',
            data: arr_models, textStyle: {
                color: "#e9ebee"

            }
        },*/
       /* toolbox: {
            show: false,
            feature: {
                mark: { show: true },
                dataView: { show: true, readOnly: false },
                magicType: {
                    show: true,
                    type: ['pie', 'funnel'],
                    option: {
                        funnel: {
                            x: '25%',
                            width: '50%',
                            funnelAlign: 'left',
                            max: 1548
                        }
                    }
                },
                restore: { show: true },
                saveAsImage: { show: true }
            }
        },*/
        calculable: true,
        series: [
           
            {
                name: '车型',
                type: 'pie',
                radius: '55%',
                center: ['50%', '60%'],
                data: arr_num,
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            position: 'top',
                            formatter: "{c},{b},{d}%",
                        }
                    },
                },
            }
        ]
    };


    myChart.setOption(option);
};


function get_xx_echarts(rtn) {
    var arr_num = new Array;//接单
    var arr_dat = new Array;
    var arr_num_fa = new Array;//发车

    for (var i = 0; i <= rtn.jdqs.length - 1; i++) {
        //console.log(rtn.jdqs[i].numa);
        arr_num.push(rtn.jdqs[i].numa);
        arr_dat.push(rtn.jdqs[i].dat);
    }

    for (var i = 0; i <= rtn.sale_fa.length - 1; i++) {
        //console.log(rtn.jdqs[i].numa);
        arr_num_fa.push(rtn.sale_fa[i].numa);
        //arr_dat.push(rtn.jdqs[i].dat);
    }

var myChart = echarts.init(document.getElementById('userContainerPrize'));
var option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    grid: {
        x: 46,
        y: 30,
        x2: 32,
        y2: 40,
        borderWidth: 0
    },
    legend: {
        data: ['销售接单', ''],
        textStyle: {
            color: "#e9ebee"

        }
    },
    xAxis: [
        {
            type: 'category',
            data: arr_dat,
            splitLine: {
                show: true
            },
            axisLabel: {
                interval: 0,
                show: true,
                textStyle: {
                    color: '#a4a7ab',
                    align: 'center'
                }
            }
        }
    ],
    yAxis: [
        {
            type: 'value',
            splitLine: {
                show: true
            },
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#a4a7ab'
                }
            }
        }
    ],
    series: [
        {
            name: '销售接单',
            type: 'line',
            data: arr_num,
            itemStyle: {
                normal: {
                    label: {
                        show: true,
                        position: 'top',
                        formatter: "{c}",
                    }
                },
            }
        },
        /*{
            name: '销售发车',
            type: 'bar',
            data: arr_num_fa,
            itemStyle: {
                normal: {
                    label: {
                        show: true,
                        position: 'top',
                        formatter: "{c}",
                    }
                },
            }
        },*/
    ]
};

myChart.setOption(option);
};

function get_prize_echarts() {
    var myChart = echarts.init(document.getElementById('userPrize'));
    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            x: 46,
            y: 30,
            x2: 32,
            y2: 40,
            borderWidth: 0
        },
        xAxis: {
            type: 'value',
            x: '180',
            splitLine: {
                show: false
            },
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#a4a7ab'
                }
            }
        },
        yAxis: {
            type: 'category',
            data: ydata.tdname,
            splitLine: {
                show: false
            },
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#a4a7ab',
                    fontSize: 9
                }
            }
        },
        series: [
            {
                name: '事件发生数量',
                type: 'bar',
                stack: '总量',
                data: ydata.tdnum,
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            position: 'top',
                            
                        }
                    },
                }
            }
        ]
    };


    myChart.setOption(option);
}

function BootstrapTable_t(rtn) {
    var _data = rtn.data;//直接把数据给bootstrapTable,不要
    //console.log(_data.data);
    $('#table').bootstrapTable({
        method: "get",
        striped: true,
        singleSelect: false,
        data:_data,
        //url: urlstr,
        dataType: "json",
        pagination: true, //分页
        pageSize: 3,
        pageNumber: 1,
        search: false, //显示搜索框
        contentType: "application/x-www-form-urlencoded",
        queryParams: null,
        columns: [
            {
                title: '接单时间',
                field: 'checK_DATE',
                width: 60,
                align: 'center',
                valign: 'middle'
            },
            {
                title: '经销商名称',
                field: 'dealeR_SHORTNAME',
                width: 80,
                align: 'center',
                valign: 'middle'
            },

            {
                title: '订单编号',
                field: 'ordeR_NO',
                width: 70,
                align: 'center'
            },

            {
                title: '数量',
                field: 'ordeR_QUANTITY',
                width: 30,
                align: 'center'
            },
            {
                title: '金额',
                field: 'ordeR_AMOUNT',
                width: 50,
                align: 'center'
            },
            {
                title: '备注',
                field: 'chassiS_REMARK',
                width: 50,
                align: 'center'
            },
            {
                title: '操作',
                field: 'chassiS_REMARK',
                width: 40,
                align: 'center',
                formatter: function (value, row) {
                    var e = '<a  href="javascript:void(0)" title="" onclick=get_dd_item("' + value + '")>详情</a> ';
                    return e;
                }
            }

        ]
    });

}

function get_dd_item(alld) {
    //alert(rootpath+'/extr_bai_eventControl/get_other_pic');
    $("#extr_body_wind").html("");
     
    //	$('#my_extr_bai_event').modal('toggle'); //对模态窗体控制开关
    $('#operator_type_bai_event').text("订单说明");
    $("#extr_body_wind").html(alld);
    openDiv();
    //  alert(id);	
    //	$('#my_extr_bai_event').modal('toggle'); //对模态窗体控制开关
    //	$('#operator_type_bai_event').text(id);
}




